package com.example.test.entity;

import com.example.test.group.UserGroup;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
@ToString
public class User {
    //光标在类里面按alt+insert,选择getter与setter自动生成
    @NotNull(message = "id不能为空",groups = {UserGroup.Edit.class})
    private Integer id;
    @NotBlank(message = "username不能为空",groups = {UserGroup.Add.Username.class})
    private String username;
    @NotBlank(message = "password不能为空",groups = {UserGroup.Add.Password.class})
    private String password;
    @NotBlank(message = "email不能为空",groups ={UserGroup.Add.Email.class})
    private String email;
    private String roleName;
    @NotNull(message = "age不能为空",groups = {UserGroup.Add.Age.class})
    @Range(min=1,max=100,message = "age必须在1到100之间",groups = {UserGroup.Add.Age.class})
    private Integer age;

    private String salt;

}
